## Display the table ----htmltools::tagList(DT::datatable(fish_traits))
traits correlation
Code
M <-cor(numeric_traits[, c(-1)])ggcorrplot::ggcorrplot(M, hc.order =TRUE, type ="lower",lab =TRUE, tl.cex =9, lab_size =3)
Code
ggsave("corrplot.png", path ="figures")
Code
# list of species sp_names <-c(rownames(fish_traits), "Nannobrachium_atrum", "Cyclothone", "Stomias_boa_boa")# taxonomic_familiestaxonomic_families <- sp_names %>%as.data.frame() %>%`colnames<-`("species") %>%mutate(family =case_when( species %in%c("Benthosema_glaciale","Ceratoscopelus_maderensis","Diaphus_metopoclampus","Lampanyctus_ater","Lampanyctus_crocodilus","Lampanyctus_macdonaldi","Lobianchia_gemellarii","Myctophum_punctatum","Notoscopelus_bolini","Notoscopelus_kroyeri","Bolinichthys_supralateralis" ) ~"Myctophidae", species %in%c("Borostomias_antarcticus","Chauliodus_sloani","Malacosteus_niger","Melanostomias_bartonbeani","Stomias_boa" ) ~"Stomiidae", species %in%c("Holtbyrnia_anomala","Holtbyrnia_macrops","Maulisia_argipalla","Maulisia_mauli","Maulisia_microlepis","Normichthys_operosus","Searsia_koefoedi","Sagamichthys_schnakenbecki" ) ~"Platytroctidae", species %in%c("Sigmops_bathyphilus","Gonostoma_elongatum") ~"Gonostomatidae", species %in%c("Argyropelecus_hemigymnus","Maurolicus_muelleri","Argyropelecus_olfersii" ) ~"Sternoptychidae", species =="Anoplogaster_cornuta"~"Anoplogastridae", species %in%c("Arctozenus_risso", "Paralepis_coregonoides") ~"Paralepididae", species =="Bathylagus_euryops"~"Bathylagidae", species =="Cyclothone_sp"~"Gonostomatidae", species =="Derichthys_serpentinus"~"Derichthyidae", species =="Eurypharynx_pelecanoides"~"Eurypharyngidae", species =="Evermannella_balbo"~"Evermannellidae", species =="Lestidiops_sphyrenoides"~"Lestidiidae", species =="Melanostigma_atlanticum"~"Zoarcidae", species %in%c("Photostylus_pycnopterus","Xenodermichthys_copei") ~"Alepocephalidae", species =="Serrivomer_beanii"~"Serrivomeridae" ) )
The first column contains traits name. The second column contains traits type following this code:
N: nominal trait (factor variable)
O: ordinal traits (ordered variable)
Q: quantitative traits (numeric values)
1/3 of the traits are nominal (traits related to teeth and photophores), need to give them different weights so as not to overestimate functional diversity?
Community Weighted Mean : somme de l’abondance relative d’une espèce x valeur du trait
trait quantittatif : valeur moyenne du trait si on prend un individu au hasard dans l’assemblage
trait catégoriel : proportion des espèces possédant ce trait, une valeur élevée peut indiquer soit qu’un grand nombre possèdent se trait ou que l’espèce avec la plus forte abondance relative possède ce trait
données centrées-réduites
Code
# spxtraits.matrix ----spxcom.matrix <- depth_fish_biomass %>%t() %>%as.data.frame() %>%relocate("Epipelagic", "Upper mesopelagic", "Lower mesopelagic","Bathypelagic" ) %>% tibble::rownames_to_column("species") %>%arrange(species) %>% tibble::column_to_rownames("species") %>%as.matrix()library(dplyr)spxtraits.matrix <- fish_traits %>%mutate(across(16:23, ~case_when(. =="P"~1, . =="A"~0, TRUE~as.numeric(.))),across(24, ~case_when(. =="A"~1, . =="B"~2, . =="C"~3, TRUE~as.numeric(.)))) %>%select(-c(gill_raker_types, oral_gape_axis)) %>%as.matrix()# Remove the "[,1]" suffix from column namesnames(spxtraits.matrix) <-gsub("[,1]", "", names(spxtraits.matrix))#check rownames#rownames(spxtraits.matrix) == rownames(spxcom.matrix)result_CWM <- FD::functcomp(spxtraits.matrix, t(spxcom.matrix)) #FD::functcomp(spxtraits.matrix, t(spxcom.matrix), CWM.type = "all")# Calculate Total biomasstotal_biomass <-colSums(spxcom.matrix)# Calculate Relative biomasssp_rel_biomass <-t(spxcom.matrix) / total_biomass# Transpose the Relative biomass Matrix for Displayt_sp_rel_biomass <-t(sp_rel_biomass)total_sum <-colSums(t(sp_rel_biomass))# Initialize an empty data frame to store resultsCWM_df <-data.frame(depth_layer =character(),trait =character(),total_sum =numeric(),weighted_mean =numeric(),stringsAsFactors =FALSE)# Loop through each traitfor (trait incolnames(spxtraits.matrix)) {# Calculate the weighted sum for the current trait weighted_sum <-colSums(t_sp_rel_biomass * spxtraits.matrix[, trait])# Create a data frame for the current trait trait_df <-data.frame(depth_layer =colnames(t_sp_rel_biomass),trait = trait,total_sum = total_sum,weighted_mean = weighted_sum )# Append results to the main data frame CWM_df <-rbind(CWM_df, trait_df)}CWM_df <- CWM_df %>%mutate(traits_names=gsub("_"," ", trait)) biomass <- t_sp_rel_biomass %>%as.data.frame() %>% tibble::rownames_to_column(var ="species") %>% tidyr::pivot_longer(!species, names_to ="depth_layer", values_to ="biomass") CWM_df <- CWM_df %>%filter(!trait%in%c("chin_barbel","dorsal_fin_insertion", "eye_position","gland_head", "oral_gape_position", "oral_gape_shape","pectoral_fin_position", "retractable_teeth","transversal_shape")) %>%mutate(traits_names=gsub("_"," ", trait)) CWM_df$depth_layer <-factor(CWM_df$depth_layer, levels =c("Epipelagic", "Upper mesopelagic","Lower mesopelagic", "Bathypelagic"))CWM_df$traits_names <-factor(CWM_df$traits_names, levels =c( "caudal throttle width", "oral gape surface","large teeth", "eye size","orbital length","small teeth","internal teeth", "lower jaw length","pectoral fin insertion", "fang teeth","operculum volume", "ventral photophores","gill outflow", "head length","body depth"))ggplot(CWM_df, aes(x = depth_layer, y = weighted_mean, group = depth_layer, color = depth_layer)) +geom_point(position =position_dodge(width =0.75), size =3) +facet_wrap(~traits_names, scales ="free", ncol =3) +scale_color_manual(values =c("#FEA520","#D62246","#6255B4","#3C685A"))+labs(x ="",y ="Community Weighted Mean ") +guides(col="none")+theme_light()+theme(axis.text.x =element_blank(), axis.title.x =element_blank(), axis.title.y.left =element_text(size =14), strip.text =element_text(size =14, face="bold"), legend.title =element_text(size =11), legend.text =element_text(size =11), axis.title.y =element_text(size=11),axis.text.y =element_text(size=12),strip.background=element_rect(fill="white"),strip.text.x =element_text(size =15, face ="bold", color ="black"))
# Function to apply Kruskal-Wallis test and effect size calculation to each groupkruskal_with_effsize <-function(data, trait_name) { kruskal_res <- rstatix::kruskal_test(data, mean ~ depth_layer) effsize_res <- rstatix::kruskal_effsize(data, mean ~ depth_layer) combined_res <-cbind(trait = trait_name, kruskal_res, effsize_res)return(combined_res)}# Perform the Kruskal-Wallis test and calculate the eta² statistic for each traitres.kruskal <- np_bootstrapped_moments_plot %>%group_by(trait) %>%group_map(~kruskal_with_effsize(.x, .y$trait)) %>%bind_rows()# View the resultshtmltools::tagList(DT::datatable(res.kruskal))
## Summary of the assemblages * species data.frame ----asb_sp_fish_summ <- mFD::asb.sp.summary(asb_sp_w = depth_fish_biomass)asb_sp_fish_occ <- asb_sp_fish_summ$"asb_sp_occ"htmltools::tagList(DT::datatable(asb_sp_fish_occ))
2.2 Computing distances between species based on functional traits
We have non-continuous traits so we use the Gower distance(metric = “gower”) as this method allows traits weighting.
scale_euclid = TRUE
Code
sp_dist_fish <- mFD::funct.dist(sp_tr = fish_traits,tr_cat = fish_traits_cat,metric ="gower",scale_euclid ="scale_center",ordinal_var ="classic",weight_type ="equal",stop_if_NA =TRUE)## Output of the function mFD::funct.dist() ----#round(sp_dist_fish, 3)
2.3 Building functional spaces and chosing the best one
2.3.1 Computing several multimensional functional spaces and assessing their quality
mFD evaluates the quality of PCoA-based multidimensional spaces according to the deviation between trait-based distances and distances in the functional space (extension of Maire et al. (2015) framework).
This function generates a figure with three panels (in rows) for each selected functional space (in columns). Each column represents a functional space, the value of the quality metric is written on the top of each column. The x-axis of all panels represents trait-based distances. The y-axis is different for each row:
on the first (top) row, the y-axis represents species functional distances in the multidimensional space. Thus, the closer species are to the 1:1 line, the better distances in the functional space fit trait-based ones.
on the second row, the y-axis shows the raw deviation of species distances in the functional space compared to trait-based distances. Thus, the raw deviation reflects the distance to the horizontal line.
on the third row (bottom), the y-axis shows the absolute or squared deviation of the (“scaled”) distance in the functional space. It is the deviation that is taken into account for computing the quality metric.
2.3.3 Testing the correlation between functional axes and traits
Code
sp_faxes_coord_fish <- fspaces_quality_fish$"details_fspaces"$"sp_pc_coord"# As we have 26 traits we have to split the df to see correlation between functional axes and traits # first set ----fish_traits_1 <- fish_traits%>%select(1:9)fish_tr_faxes <- mFD::traits.faxes.cor(sp_tr = fish_traits_1, sp_faxes_coord = sp_faxes_coord_fish[ , c("PC1", "PC2", "PC3", "PC4")], plot = T)## Print traits with significant effect ----fish_tr_faxes$"tr_faxes_stat"[which(fish_tr_faxes$"tr_faxes_stat"$"p.value"<0.05), ]
trait axis test stat value p.value
1 eye_size PC1 Linear Model r2 0.166 0.0081
2 eye_size PC2 Linear Model r2 0.160 0.0096
3 eye_size PC3 Linear Model r2 0.140 0.0158
4 eye_size PC4 Linear Model r2 0.139 0.0164
5 orbital_length PC1 Linear Model r2 0.398 0.0000
6 orbital_length PC2 Linear Model r2 0.114 0.0306
10 gill_outflow PC2 Linear Model r2 0.520 0.0000
13 oral_gape_surface PC1 Linear Model r2 0.136 0.0176
14 oral_gape_surface PC2 Linear Model r2 0.499 0.0000
18 oral_gape_shape PC2 Linear Model r2 0.141 0.0157
24 oral_gape_position PC4 Linear Model r2 0.200 0.0034
26 lower_jaw_length PC2 Linear Model r2 0.694 0.0000
29 head_length PC1 Linear Model r2 0.315 0.0001
30 head_length PC2 Linear Model r2 0.400 0.0000
34 body_depth PC2 Linear Model r2 0.360 0.0000
35 body_depth PC3 Linear Model r2 0.196 0.0038
Code
## Plot ----fish_tr_faxes$"tr_faxes_plot"
Code
# second set ----fish_traits_2 <- fish_traits%>%select(10:18)fish_tr_faxes_2 <- mFD::traits.faxes.cor(sp_tr = fish_traits_2, sp_faxes_coord = sp_faxes_coord_fish[ , c("PC1", "PC2", "PC3", "PC4")], plot = T)## Print traits with significant effect ----fish_tr_faxes_2$"tr_faxes_stat"[which(fish_tr_faxes_2$"tr_faxes_stat"$"p.value"<0.05), ]
trait axis test stat value p.value
2 pectoral_fin_position PC2 Linear Model r2 0.268 0.0005
5 pectoral_fin_insertion PC1 Linear Model r2 0.272 0.0005
6 pectoral_fin_insertion PC2 Linear Model r2 0.412 0.0000
9 transversal_shape PC1 Linear Model r2 0.114 0.0309
11 transversal_shape PC3 Linear Model r2 0.228 0.0016
14 caudal_throttle_width PC2 Linear Model r2 0.402 0.0000
19 dorsal_fin_insertion PC3 Linear Model r2 0.170 0.0073
23 eye_position PC3 Linear Model r2 0.200 0.0034
26 operculum_volume PC2 Linear Model r2 0.126 0.0227
32 ventral_photophores PC4 Kruskal-Wallis eta2 0.590 0.0000
33 gland_head PC1 Kruskal-Wallis eta2 0.245 0.0011
Code
## Plot ----fish_tr_faxes_2$"tr_faxes_plot"
Code
# third set ----fish_traits_3 <- fish_traits%>%select(19:25)fish_tr_faxes_3 <- mFD::traits.faxes.cor(sp_tr = fish_traits_3, sp_faxes_coord = sp_faxes_coord_fish[ , c("PC1", "PC2", "PC3", "PC4")], plot = T)## Print traits with significant effect ----fish_tr_faxes_3$"tr_faxes_stat"[which(fish_tr_faxes_3$"tr_faxes_stat"$"p.value"<0.05), ]
a data.frame gathering indices values in each assemblage (for FIde values, there are as many columns as there are axes to the studied functional space).
a details list of data.frames and lists gathering information such as coordinates of centroids, distances and identity of the nearest neighbour, distances to the centroid, etc. The user does not have to directly use it but it will be useful if FD indices are then plotted. It can be retrieved through:
the proportion of functional space filled by species of the studied assemblage, i.e. the volume inside the convex-hull shaping species. To compute FRic the number of species must be at least higher than the number of functional axis + 1.
Only between epipelagic and bathypelagic layers
Code
plots_alpha$"fric"$"patchwork"
FDiv Functional Divergence
the proportion of the biomass supported by the species with the most extreme functional traits i.e. the ones located close to the edge of the convex-hull filled by the assemblage
Code
plots_alpha$"fdiv"$"patchwork"
FEve Functional Evenness
the regularity of biomass distribution in the functional space using the Minimum Spanning Tree linking all species present in the assemblage.
Code
plots_alpha$"feve"$"patchwork"
FSpe Functional Specialization
the biomass weighted mean distance to the mean position of species from the global pool (present in all assemblages).
Code
plots_alpha$"fspe"$"patchwork"
FDis Functional Dispersion
the biomass weighted deviation of species traits values from the center of the functional space filled by the assemblage i.e. the biomass-weighted mean distance to the biomass-weighted mean trait values of the assemblage.
Code
plots_alpha$"fdis"$"patchwork"
FIde Functional Identity
the mean traits values for the assemblage. FIde is always computed when FDis is computed.
Code
plots_alpha$"fide"$"patchwork"
3.2.Computing and plotting beta FD indices
The function returns a list containing:
a dist object with beta indices values for each pair of assemblages:
Rao diversity (Q) : Sum of distances between pairs of randomly chosen species in trait space weighted by a relative abundance
Functional redundancy : difference between species diversity and Rao’s quadratic entropy based on their functional dissimilarity (de Bello et al. 2007)
Functionnal redundancy Ricotta = 1-Q/D
Comparison with null models taking species diversity into account ? (SESRoa, SESRedon…)
Functional distinctiveness is the mean of dissimilarity of the focal species to all the other species of the set of interest. It can be abundance-weighted if needed.
Functional uniqueness is the smallest dissimilarity that exists between the focal species and the all other species in the set. It does not consider the abundance of any species.
Rarity indices:
Scarcity is proportional to the relative abundance of the species. It gets close to one when the species is (relatively) rare and close to 0 when its dominant
Restrictedness is 1 minus the ratio of sites a species occupy over the total number of sites.
4.2.Computing functional rarity
4.2.1 Functional originality at regional scale
For the choice or dissimilarity matrix we can use the raw dissimilarity matrix computed directly on raw traits values among species:
To compute uniqueness at regional scale we also need the regional level functional dissimilarity matrix with the uniqueness() function, and the site-species matrix:
Code
sp_ui <- funrar::uniqueness(pres_matrix = depth_fish_biomass,as.matrix(sp_dist_fish))quantile(sp_ui$Ui, probs =seq(0, 1, by =0.1))
Based on these results we see that Anoplogaster cornuta, and Malacosteus niger are the most isolated fish in the functional space. Meaning that they have the most distant nearest neighbors.
As we had to manually build the function to compute the local uniqueness the results are strangely formatted.
We provide here a function that can help them to be more easily read:
Code
depth_ui <-lapply(names(depth_ui), function(x) { single_depth = depth_ui[[x]] single_depth$site = xreturn(single_depth)})depth_ui <-do.call(rbind, depth_ui)#Then we can again look at the apple to see how its uniqueness varies across depths.subset(depth_ui, species =="Melanostomias_bartonbeani")
Anoplogaster_cornuta Arctozenus_risso Argyropelecus_hemigymnus
Min. :0.9307 Min. :0.2023 Min. :0.9565
1st Qu.:0.9307 1st Qu.:0.2305 1st Qu.:0.9806
Median :0.9307 Median :0.3366 Median :0.9901
Mean :0.9307 Mean :0.3458 Mean :0.9826
3rd Qu.:0.9307 3rd Qu.:0.4520 3rd Qu.:0.9920
Max. :0.9307 Max. :0.5078 Max. :0.9936
NA's :3
Argyropelecus_olfersii Bathylagus_euryops Benthosema_glaciale
Min. :0.1341 Min. :0.1674 Min. :0.09242
1st Qu.:0.4303 1st Qu.:0.1674 1st Qu.:0.10461
Median :0.5531 Median :0.1674 Median :0.34726
Mean :0.4937 Mean :0.1674 Mean :0.42017
3rd Qu.:0.6166 3rd Qu.:0.1674 3rd Qu.:0.66282
Max. :0.7345 Max. :0.1674 Max. :0.89375
NA's :3
Bolinichthys_supralateralis Borostomias_antarcticus Ceratoscopelus_maderensis
Min. :0.9085 Min. :0.7711 Min. :0.1811
1st Qu.:0.9279 1st Qu.:0.9244 1st Qu.:0.2566
Median :0.9472 Median :0.9827 Median :0.4640
Mean :0.9472 Mean :0.9321 Mean :0.4547
3rd Qu.:0.9666 3rd Qu.:0.9903 3rd Qu.:0.6622
Max. :0.9859 Max. :0.9919 Max. :0.7098
NA's :2
Chauliodus_sloani Cyclothone_sp Derichthys_serpentinus
Min. :0.6243 Min. :0.4460 Min. :0.9488
1st Qu.:0.8282 1st Qu.:0.7333 1st Qu.:0.9633
Median :0.9415 Median :0.8690 Median :0.9779
Mean :0.8768 Mean :0.7822 Mean :0.9710
3rd Qu.:0.9901 3rd Qu.:0.9179 3rd Qu.:0.9821
Max. :1.0000 Max. :0.9448 Max. :0.9864
NA's :1
Diaphus_metopoclampus Evermannella_balbo Gonostoma_elongatum
Min. :0.9889 Min. :0.8112 Min. :0.8448
1st Qu.:0.9904 1st Qu.:0.9025 1st Qu.:0.8754
Median :0.9920 Median :0.9939 Median :0.9060
Mean :0.9920 Mean :0.9340 Mean :0.9060
3rd Qu.:0.9936 3rd Qu.:0.9954 3rd Qu.:0.9365
Max. :0.9951 Max. :0.9970 Max. :0.9671
NA's :2 NA's :1 NA's :2
Holtbyrnia_anomala Holtbyrnia_macrops Lampanyctus_crocodilus
Min. :0.8722 Min. :0.9714 Min. :0.003698
1st Qu.:0.8722 1st Qu.:0.9745 1st Qu.:0.006287
Median :0.8722 Median :0.9776 Median :0.022811
Mean :0.8722 Mean :0.9784 Mean :0.048458
3rd Qu.:0.8722 3rd Qu.:0.9819 3rd Qu.:0.064982
Max. :0.8722 Max. :0.9862 Max. :0.144510
NA's :3 NA's :1
Lampanyctus_macdonaldi Lestidiops_sphyrenoides Lobianchia_gemellarii
Min. :0.3621 Min. :0.9384 Min. :0.7177
1st Qu.:0.3621 1st Qu.:0.9809 1st Qu.:0.8512
Median :0.3621 Median :0.9974 Median :0.9049
Mean :0.3621 Mean :0.9833 Mean :0.8692
3rd Qu.:0.3621 3rd Qu.:0.9999 3rd Qu.:0.9229
Max. :0.3621 Max. :1.0000 Max. :0.9493
NA's :3
Malacosteus_niger Maulisia_argipalla Maulisia_mauli Maulisia_microlepis
Min. :0.8589 Min. :0.9275 Min. :0.4351 Min. :0.5511
1st Qu.:0.8847 1st Qu.:0.9368 1st Qu.:0.7010 1st Qu.:0.5511
Median :0.9106 Median :0.9461 Median :0.9669 Median :0.5511
Mean :0.9106 Mean :0.9461 Mean :0.7991 Mean :0.5511
3rd Qu.:0.9364 3rd Qu.:0.9554 3rd Qu.:0.9812 3rd Qu.:0.5511
Max. :0.9623 Max. :0.9647 Max. :0.9954 Max. :0.5511
NA's :2 NA's :2 NA's :1 NA's :3
Maurolicus_muelleri Melanostigma_atlanticum Melanostomias_bartonbeani
Min. :0.1681 Min. :0.9270 Min. :0.9145
1st Qu.:0.7054 1st Qu.:0.9636 1st Qu.:0.9152
Median :0.9235 Median :0.9793 Median :0.9265
Mean :0.7501 Mean :0.9678 Mean :0.9419
3rd Qu.:0.9681 3rd Qu.:0.9835 3rd Qu.:0.9532
Max. :0.9853 Max. :0.9855 Max. :1.0000
Myctophum_punctatum Lampanyctus_ater Normichthys_operosus Notoscopelus_kroyeri
Min. :0.02587 Min. :0.4081 Min. :0.02368 Min. :0.1825
1st Qu.:0.37286 1st Qu.:0.6404 1st Qu.:0.02368 1st Qu.:0.2149
Median :0.49108 Median :0.8437 Median :0.02368 Median :0.2863
Mean :0.40536 Mean :0.7678 Mean :0.02368 Mean :0.2769
3rd Qu.:0.52358 3rd Qu.:0.9711 3rd Qu.:0.02368 3rd Qu.:0.3483
Max. :0.61339 Max. :0.9758 Max. :0.02368 Max. :0.3523
NA's :3
Paralepis_coregonoides Photostylus_pycnopterus Sagamichthys_schnakenbecki
Min. :0.9793 Min. :0.975 Min. :0.9664
1st Qu.:0.9827 1st Qu.:0.975 1st Qu.:0.9721
Median :0.9859 Median :0.975 Median :0.9778
Mean :0.9874 Mean :0.975 Mean :0.9751
3rd Qu.:0.9906 3rd Qu.:0.975 3rd Qu.:0.9795
Max. :0.9983 Max. :0.975 Max. :0.9811
NA's :3 NA's :1
Searsia_koefoedi Serrivomer_beanii Sigmops_bathyphilus Stomias_boa
Min. :0.5166 Min. :0.05462 Min. :0.8561 Min. :0.1152
1st Qu.:0.5425 1st Qu.:0.30778 1st Qu.:0.8880 1st Qu.:0.1431
Median :0.7013 Median :0.40401 Median :0.9199 Median :0.1813
Mean :0.6953 Mean :0.37437 Mean :0.9199 Mean :0.1968
3rd Qu.:0.8541 3rd Qu.:0.47060 3rd Qu.:0.9519 3rd Qu.:0.2350
Max. :0.8618 Max. :0.63484 Max. :0.9838 Max. :0.3093
NA's :2
Xenodermichthys_copei Notoscopelus_bolini
Min. :0.001126 Min. :0.9986
1st Qu.:0.007770 1st Qu.:0.9993
Median :0.129474 Median :1.0000
Mean :0.180620 Mean :0.9995
3rd Qu.:0.302324 3rd Qu.:1.0000
Max. :0.462404 Max. :1.0000
NA's :1
restrictiveness:
Code
ri = funrar::restrictedness(depth_fish_biomass)summary(ri)
species Ri
Length:41 Min. :0.0000
Class :character 1st Qu.:0.0000
Mode :character Median :0.0000
Mean :0.2378
3rd Qu.:0.5000
Max. :0.7500
4.3 Plotting functional rarity
4.3.1 Plotting functional originality
option to be able to colour species according to their functional originality (and not use the ready-made functions in the mfd package)
As was done with mFD to correlate the functional axes with species’ traits we can correlate functional distinctiveness to specific traits in order to see which traits are mainly driving distinctiveness.
Regarding local level functional originality indices, the visualization can be more difficult to grasp and depends highly on the question. Would you rather focus on visualizing the functional distinctiveness of one species across communities? Compare the distribution of functional distinctiveness values across communities?
One idea to keep in mind is that averaging functional distinctiveness per community is exactly equal to computing functional dispersion. Functional originality is computed on a species basis, so we should be aware that if we are rather interested by community properties than we can compute functional diversity metrics which are much more appropriate.
At the local scale: Scarcity (relative abundance of the species) as a function of the local distinctiveness (one value per depth layer for each species)
depth_biomass <-rbind(data_biomass_2002_2019, data_biomass_2021, data_biomass_2022)%>%as.data.frame()%>%rename("species"="Nom_Scientifique","station"="Code_Station") %>%left_join(metadata) %>%select(species, Tot_V_HV, depth, volume_filtered)%>%# divise biomass by the volume filtered at each trawl (g.m3)mutate(biomass_cpu=(Tot_V_HV/volume_filtered)*1000)%>%select(species, depth, biomass_cpu)%>%group_by(species, depth)%>%mutate(biomass=sum(biomass_cpu))%>%select(-c(biomass_cpu))%>%distinct() %>%mutate(species =case_when( species =="Nannobrachium_atrum"~"Lampanyctus_ater", species =="Cyclothone"~"Cyclothone_sp", species =="Stomias_boa_boa"~"Stomias_boa",TRUE~ species ))